﻿using System;
using System.Text.RegularExpressions;
using SemanticEx.Extensions;

namespace SemanticEx
{
	/// <summary>
	/// Represents the output of a validation check.
	/// </summary>
	public class Validation
	{
		internal Validation(Match match, bool isValid)
		{
			Match = match;
			Success = isValid;
		}

		public Match Match { get; private set; }

		public bool Success { get; private set; }

		public Validation Validate(string groupName, Func<string, bool> validation)
		{
			Success &= Match.Validate(groupName, validation).Success;
			return this;
		}
	}
}